home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / c / makedir.c < prev    next >
C/C++ Source or Header  |  1996-09-13  |  1KB  |  57 lines

  1. #include <exec/memory.h>
  2. #include <exec/execbase.h>
  3. #include <clib/exec_protos.h>
  4. #include <dos/dos.h>
  5. #include <clib/dos_protos.h>
  6. #include <utility/tagitem.h>
  7.  
  8. CALLENTRY /* Before the first symbol */
  9.  
  10. struct ExecBase *SysBase;
  11. struct DosLibrary *DOSBase;
  12.  
  13. static LONG tinymain(void);
  14.  
  15. LONG entry(struct ExecBase *sysbase)
  16. {
  17.     LONG error=RETURN_FAIL;
  18.     SysBase=sysbase;
  19.     DOSBase=(struct DosLibrary *)OpenLibrary("dos.library",39);
  20.     if(DOSBase!=NULL)
  21.     {
  22.     error=tinymain();
  23.     CloseLibrary((struct Library *)DOSBase);
  24.     }
  25.     return error;
  26. }
  27.  
  28. static LONG tinymain(void)
  29. {
  30.     STRPTR args[1]={ 0 };
  31.     struct RDArgs *rda;
  32.     LONG error=0;
  33.     BPTR lock;
  34.  
  35.     rda=ReadArgs("DIR/A",(IPTR *)args,NULL);
  36.     if(rda!=NULL)
  37.     {
  38.     lock = CreateDir(args[0]);
  39.  
  40.     if (lock)
  41.         UnLock(lock);
  42.     else
  43.     {
  44.         VPrintf ("Cannot create %s:", (ULONG *)args);
  45.         error = RETURN_FAIL;
  46.     }
  47.  
  48.     FreeArgs(rda);
  49.     }
  50.     else
  51.     error=RETURN_FAIL;
  52.  
  53.     if(error)
  54.     PrintFault(IoErr(),"MakeDir");
  55.     return error;
  56. }
  57.